package com.sctvcloud.longchang.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ruihang.generalibrary.ui.adapter.BaseHolderAbsAdapter;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.sctvcloud.longchang.R;
import com.sctvcloud.longchang.beans.FProgram;
import com.sctvcloud.longchang.ui.adapter.holder.ProgramItemHolder;

import java.util.List;

public class ProgramListAdapter extends BaseHolderAbsAdapter<FProgram, ProgramItemHolder> {
    private ProgramItemHolder.OnProgramItemClickListener programItemClickListener;

    public ProgramListAdapter(Context context, List<FProgram> list) {
        super(context, list);
    }


    @Override
    public ProgramItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_program_list, parent,false);
        ProgramItemHolder holder = new ProgramItemHolder(context, view, programItemClickListener);
        holder.setInternalClick(this);
        return holder;
    }


    @Override
    public ProgramListAdapter setItemInternalClick(OnItemInternalClick itemInternalClick) {
        super.setItemInternalClick(itemInternalClick);
        return this;
    }

    public void setProgramItemClickListener(ProgramItemHolder.OnProgramItemClickListener programItemClickListener) {
        this.programItemClickListener = programItemClickListener;
    }
}